package com.cskaoyan.javase.oop1._7bigexercise._1pvz;

import com.sun.org.apache.bcel.internal.generic.NEW;

/**
 * @description: 僵尸类
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

public class Zombie {
    //属性: name,hp,damage,speed
    String name;
    int hp;
    int damage;
    double speed;
    //成员列表中加上植物对象
    Plant zPlant;

    //行为: attack,beAttacked,eat,run

    public void attack() {
        System.out.println("我正在攻击" + zPlant.name);
    }

    public void beAttacked() {
        System.out.println("我被" + zPlant.name + "攻击了，我受到" + zPlant.damage + "点伤害，我还剩" + (this.hp - zPlant.damage) + "点生命值~");
    }


    public void eat() {
        System.out.println("我吃掉了你的脑子,真香!");
    }

    public void run() {
        System.out.println(name + "以" + speed + "的移动速度接近你的脑子~");
    }

    //僵尸类

    public Zombie() {
    }
    public Zombie(String name, int hp, int damage, double speed) {
        this.name = name;
        this.hp = hp;
        this.damage = damage;
        this.speed = speed;
        //this.zPlant = zPlant;
    }
}
